#include <iostream>
#include <string>
#include <cmath>
using namespace std;

bool isPrime(int num) {
    if (num < 2) return false;
    for (int i = 2; i <= sqrt(num); ++i) {
        if (num % i == 0) return false;
    }
    return true;
}

int main() {
    int L, K;
    cin >> L >> K;
    string N;
    cin >> N;

    for (int i = 0; i <= L - K; ++i) {
        string subNum = N.substr(i, K);
        int num = stoi(subNum);
        if (isPrime(num)) {
            cout << subNum << endl;
            return 0;
        }
    }

    cout << "404" << endl;
    return 0;
}    